package tata;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;

@Configuration
public class JacksonProtobufSupport {
    @Bean
    public Jackson2ObjectMapperBuilderCustomizer jackson2ObjectMapperBuilderCustomizer() {
        return jacksonObjectMapperBuilder -> {
//            jacksonObjectMapperBuilder.featuresToDisable(
//                    JsonGenerator.Feature.IGNORE_UNKNOWN,
//                    MapperFeature.DEFAULT_VIEW_INCLUSION,
//                    DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES,
//                    SerializationFeature.WRITE_DATES_AS_TIMESTAMPS
//            );
            jacksonObjectMapperBuilder.propertyNamingStrategy(PropertyNamingStrategies.LOWER_CAMEL_CASE);//如果字段都是驼峰命名规则，需要这一句
        };
    }
}
